package changeEmployeeTransaction.changeAffiliationTransaction;

import database.PayrollDatabase;
import addEmployeeTransaction.Employee;
import affiliation.Affiliation;
import affiliation.NoAffiliation;
import affiliation.UnionAffiliation;

public class ChangeUnaffiliatedTransaction extends
		ChangeAffiliationTransaction {
	public ChangeUnaffiliatedTransaction(int empId, PayrollDatabase database) {
		super(empId, database);
	}

	protected Affiliation affiliation = new NoAffiliation();

	protected void RecordMembership(Employee e) {
		Affiliation affiliation = e.getAffiliation();
		if (affiliation instanceof UnionAffiliation) {
			UnionAffiliation unionAffiliation = (UnionAffiliation) affiliation;
			int memberId = unionAffiliation.getMemberId();
			database.removeUnionMember(memberId);
		}
	}

	@Override
	protected Affiliation getAffiliation() {
		return new NoAffiliation();
	}
}
